home *** CD-ROM | disk | FTP | other *** search
/ PC Answers 2002 January / PC Answers January 2002.7z / PC Answers January 2002.bin / graphics / freepixl / _SETUP.1 / Fonttest.pxl < prev    next >
Text File  |  2000-12-23  |  5KB  |  183 lines

  1. {    Filename    :  fonttest.pxl
  2.      Purpose    : Skeleton file for PiXCL applications
  3.     Date    :    12 may 98
  4.     Author:        S.Dibbs, VYSOR Integration Inc
  5. History:
  6.  
  7.     Version    :  1.0    RELEASE
  8.     Update    :  
  9.     Date    :  
  10.  
  11. --------------------------------------------------------------------------}
  12. Initialize: {only one instance allowed}
  13.     UseCoordinates(PIXEL)
  14.     Title$ = "Using Fonts in a PiXCL Application"                                  
  15.     WinExist(Title$,Res)
  16.     If Res = 0 Then Goto One_Instance
  17.     Beep
  18.     WinSetActive(Title$,Res)
  19.     WinShow(Title$,RESTORE,Res)
  20.     End
  21. One_Instance:
  22.     UseCaption(Title$) {change the title}
  23.     WinLocate(Title$,472,188,970,594,Res)                
  24.     UseBackground(TRANSPARENT,0,128,128)     
  25.     WinShow(Title$,NOTOPMOST,Res) 
  26.     DrawBackGround
  27.     DirGet(SourceDir$) {used later for library function calls}
  28.  
  29.     {DragAcceptFile(ENABLE,AcceptFile)}
  30.     {AutoProgressBar(DISABLE)}
  31.  
  32.     InfoMenu(REMOVE)
  33.     WaitInput(100)
  34.  
  35.     SetMenu("&File",IGNORE,
  36.         "&New",CreatingFile,
  37.         "&Open",OpeningFile,
  38.         "&Save",SavingFile,
  39.         SEPARATOR,
  40.         "E&xit!",Terminate,
  41.         ENDPOPUP,
  42.         "&View",IGNORE,
  43.         "&ToolBar",ViewToolBar,
  44.         "&StatusBar",ViewStatusBar,
  45.         ENDPOPUP,
  46.         "&Information",IGNORE,
  47.         "&Concept",Concept,
  48.         "&Help",ShowAppHelp,
  49.         SEPARATOR,
  50.         "&About",About,
  51.         ENDPOPUP)
  52.  
  53.     GoSub MakeToolbar
  54.     ChangeMenuItem("&ToolBar",CHECK,TBRes)
  55.  
  56.         
  57.     StatusWindow(ENABLE,BOTTOM,2,200,-1,0,0)
  58.     DrawStatusWinText(0,"Ready")
  59.     ChangeMenuItem("&StatusBar",CHECK,SBRes)
  60.  
  61. Wait_for_Input:
  62.     WaitInput()
  63.  
  64. Terminate:
  65.     End
  66.  
  67.  
  68. Concept:
  69.     MessageBox(OK,1,INFORMATION,
  70. "This is a skeleton of a PiXCL application.  You could briefly
  71. describe your application's function here, or provide some
  72. basic help information.",
  73.     "PiXCL Skeleton Concept",Res)
  74.  
  75.     Goto Wait_for_Input
  76.  
  77. ShowAppHelp:
  78.     {An application Help file usually has the same name as the application.}
  79.     Winhelp("test.hlp",CONTENTS,"")
  80.  
  81.     Goto Wait_for_Input
  82.  
  83. About:
  84.     AboutUser("PiXCL Application Title",  { or substitute Title$}
  85.       "Two lines of text goes here e.g. Application function.",
  86.     "Four Lines of additional information goes here, perhaps contact information and Web addresses")
  87.  
  88.     Goto Wait_for_Input
  89.  
  90. ViewToolBar:
  91.     GetMenuStatus("&ToolBar",CHECKED,Res)
  92.     If Res = 0
  93.         GoSub MakeToolbar
  94.         ChangeMenuItem("&ToolBar",CHECK,Res)
  95.     Else
  96.         Toolbar()
  97.         ChangeMenuItem("&ToolBar",UNCHECK,Res)
  98.     Endif
  99.     Goto Wait_for_Input
  100.  
  101. ViewStatusBar:
  102.     GetMenuStatus("&StatusBar",CHECKED, Res)
  103.     If Res = 0
  104.         StatusWindow(ENABLE,BOTTOM,2,200,-1,0,0)
  105.         DrawStatusWinText(0,"Ready")
  106.         ChangeMenuItem("&StatusBar",CHECK,Res)
  107.     Else
  108.         StatusWindow(DISABLE,BOTTOM,2,200,-1,0,0)
  109.        ChangeMenuItem("&StatusBar",UNCHECK,Res)
  110.     Endif
  111.     Goto Wait_for_Input
  112.  
  113. CreatingFile:
  114.     DrawBackground
  115.     SetDrawMode(BACKGND) 
  116.     Image1$ = SourceDir$ + "\1iddnext.bmp"
  117.     DrawBitmap(100,50,Image1$)
  118.     WaitInput(2000)    
  119.     ReDraw    
  120.     Goto Wait_for_Input
  121.  
  122. OpeningFile:
  123.     SetDrawMode(BACKGND)
  124.     UseBackGround(TRANSPARENT,255,0,0)
  125.     DrawBackground
  126.     WaitInput(1000)
  127.     SetDrawMode(FOREGND)
  128.     UseBackGround(TRANSPARENT,96,128,0)
  129.     DrawBackground
  130.     WaitInput(1000)
  131.     DrawBackgroundRegion(100,100,300,200)
  132.     SetDrawMode(BOTH)
  133.  
  134.     AddFont("c:\windows\fonts\tahoma.ttf",Res)
  135.     If Res = 0 Then DrawStatusWinText(0,"AddFont failed")
  136.     If Res = 1 Then DrawStatusWinText(0,"AddFont succeeded")
  137.     UseFont("Tahoma",11,17,NOBOLD,ITALIC,NOUNDERLINE,255,255,0)
  138.  
  139.     GetTextSpacing(Tspace)
  140.     Tspace += 2
  141.     DrawText(10,50,"standard spacing")
  142.     Tspace += 2
  143.     SetTextSpacing(Tspace)
  144.     DrawText(10,70,"modified spacing")
  145.     Tspace += 2
  146.     SetTextSpacing(Tspace)
  147.     DrawText(10,90,"modified spacing")
  148.     Tspace += 2
  149.  
  150.     UseFont("Tahoma",15,31,NOBOLD,ITALIC,NOUNDERLINE,255,255,0)
  151.  
  152.     SetTextSpacing(Tspace)
  153.     {the SetTextSpacing is required each time if the WaitInput is used}
  154.     DrawText(10,110,"modified spacing") WaitInput(200) SetTextSpacing(Tspace)
  155.     DrawText(11,110,"modified spacing")  WaitInput(200) SetTextSpacing(Tspace)
  156.     DrawText(13,110,"modified spacing")  WaitInput(200) SetTextSpacing(Tspace)
  157.     DrawText(14,110,"modified spacing")
  158.     Goto Wait_for_Input
  159.  
  160. SavingFile:
  161.     RemoveFont("c:\windows\fonts\tahoma.ttf",Res)
  162.     If Res = 1 Then DrawStatusWinText(0,"Font removed")
  163.     Goto Wait_for_Input
  164.  
  165. AcceptFile:
  166.     GetDragList(FileList$)
  167.     {TODO: add file list handling here, or delete this whole label handler}
  168.     Goto Wait_for_Input
  169.     
  170.  
  171. {--- Style Suggestion: place all subroutines at the end of the script.}
  172.  
  173. MakeToolbar: {subroutine}
  174.     Toolbar(    RAISED, PXL_SMALL,
  175.         NULL, NULL, SEPARATOR, "", Wait_for_Input,
  176.         PXL_NEW, ENABLED, STD, "Background Draw mode", CreatingFile,
  177.         PXL_OPEN, ENABLED, STD, "Loading fonts, character spacing", OpeningFile,
  178.         PXL_SAVE, ENABLED, STD, "Removing a loaded font", SavingFile,
  179.         NULL, NULL, SEPARATOR, "", Wait_for_Input,
  180.         HELPINFO, ENABLED, STD,"Show Help",ShowAppHelp)
  181.  
  182.     Return
  183.